package service.impl;

import mapper.PatientMapper;
import model.Patient;
import org.springframework.stereotype.Service;
import service.PatientService;

import javax.annotation.Resource;

@Service
public class PatientServiceImpl implements PatientService {
    @Resource
    private PatientMapper mapper;
    @Override
    public int add(Patient patient) {
        //有重复不进行添加操作
        if(mapper.checkCard(patient.getIdCard())+ mapper.checkMedicare(patient.getIdMedicare())>0){
            return 0;
        }
        return mapper.add(patient);
    }

    @Override
    public int checkMedicare(String id) {
        return mapper.checkMedicare(id);
    }

    @Override
    public int checkCard(String id) {
        return mapper.checkCard(id);
    }
}
